<ap></ap>{include file="common/head"/}
<style type="text/css">
    .layui-table-cell {
    height: 78px;
}
</style>
<div class="admin-main layui-anim layui-anim-upbit">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>员工服务统计{:lang('list')}</legend>
    </fieldset>
    <div class="demoTable">
         <div class="layui-inline">
            <label class="layui-form-label">统计年份:</label>
            <div class="layui-input-inline">
                <select name="year" id="year" lay-verify="required" lay-search="" class="layui-select">
                    {foreach name="years" item="v" key="k"}
                    <option value="{$v}">{$v}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">统计月份:</label>
            <div class="layui-input-inline">
                <select name="month" id="month" lay-verify="required" lay-search="" class="layui-select">
                    <option value="">选择月份</option>
                    {for start="1" end="13" name="i"}
                    <option value="{if condition="$i lt 10"}0{$i}{else/}{$i}{/if}" {if condition="$m eq $i"}selected{/if} >{$i}月</option>
                    {/for}
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">员工:</label>
            <div class="layui-input-inline">
                <select name="yid" id="yid" lay-verify="required" lay-search="" class="layui-select">
                    <option value="">选择员工</option>
                    {foreach name="worker" item="v" key="k"}
                    <option value="{$v['id']}">{$v['name']}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">桌号:</label>
            <div class="layui-input-inline">
                <select name="tid" id="tid" lay-verify="required" lay-search="" class="layui-select">
                    <option value="">选择桌号</option>
                    {foreach name="tables" item="v" key="k"}
                    <option value="{$v['id']}">{$v['title']}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <button class="layui-btn" id="search" data-type="reload">搜索</button>
    </div>

    <div class="demoTable" style="padding-top: 20px;" >
        <div class="layui-inline">
            <label class="layui-form-label">满意:</label>
            <div class="layui-input-inline">
                <button type="button" class="layui-btn" id="my">0</button>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">还行:</label>
            <div class="layui-input-inline">
                <button type="button" class="layui-btn layui-btn-warm" id="hx">0</button>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">不满意:</label>
            <div class="layui-input-inline">
                <button type="button" class="layui-btn layui-btn-danger" id="bmy">0</button>
            </div>
        </div>
    </div>
    <table class="layui-table" id="list" lay-filter="list"></table>
</div>

{include file="common/foot"/}



<script>
    layui.use(['table','form'], function() {
        var table = layui.table,form = layui.form,$ = layui.jquery;
        var param = {:json_encode($param)};
        var tableIn = table.render({
            elem: '#list',
            url: '{:url("index")}',
            width: "100%",
            method:'post',
            toolbar: '#topBtn',
            title:'{:lang("admin")}{:lang("list")}',
            cols: [param],
            done: function(res, curr, count){
                //如果是异步请求数据方式，res即为你接口返回的信息。
                //如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
                // console.log(res.my);
                $("#my").text(res.my);
                $("#hx").text(res.hx);
                $("#bmy").text(res.bmy);
            }
        });

        //搜索
        $('#search').on('click', function() {
            var year = $('#year').val();
            var month = $('#month').val();
            var yid = $('#yid').val();
            var tid = $('#tid').val();
            // if(yid==='' && tid ==='') {
            //     layer.msg('{:lang("pleaseEnter")}搜索条件！',{icon:0});
            //     return;
            // }
            tableIn.reload({ page: {page: 1},where: {yid: yid,tid:tid,year:year,month:month}});
        });

    });
</script>
</body>
</html>